package org.example.sringbootiocsample.controller;

import org.example.sringbootiocsample.service.UserServiceComponent;
import org.example.sringbootiocsample.service.UserServiceConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
public class UserController
{
    @Autowired
    private UserServiceComponent userServiceComponent;

    @Autowired
    private UserServiceConfiguration userServiceConfiguration;

    @Qualifier("Component_GetBeanId")
    @Autowired
    String GetId;

    @RequestMapping("/getUser1")
    public String getUser1() {
        System.out.println(userServiceComponent);
        return LocalDateTime.now()+ "_" + userServiceComponent.GetId();
    }

    @RequestMapping("/getUser2")
    public String getUser2() {
        System.out.println(userServiceConfiguration);
        return LocalDateTime.now() + "_" + userServiceConfiguration.GetId();
    }

    @RequestMapping("/getUser3")
    public String getUser3() {
        System.out.println(userServiceComponent);
        return LocalDateTime.now() + "_" + userServiceComponent.GetBeanId();
    }

    @RequestMapping("/getUser4")
    public String getUser4() {
        System.out.println(userServiceConfiguration);
        return LocalDateTime.now() + "_" + userServiceConfiguration.GetBeanId();
    }

    @RequestMapping("/getUser5")
    public String getUser5() {
        return LocalDateTime.now() + "_" + GetId;
    }


}
